﻿using System;
using System.Web;
using Ue.Framework.Web;
using Ue.Infrastructure.RepositoryFramework;
using Ue.Qcdz.Domain.FriendLink;

namespace Ue.Qcdz.UI.Controller
{
    public class FriednLinkController : Ue.Infrastructure.Web.AsyncHandlers.AsyncResult
    {
        private IFriendLinksRepository friendLinksRepository;
        private FriendLinks friendlink;
        public FriednLinkController(AsyncCallback callback, HttpContext context, object state) : base(callback, context, state)
        {
            Guid guid = context.Request.GetQueryValue<Guid>("friendLinkId");
            friendLinksRepository = RepositoryFactory.GetRepository<IFriendLinksRepository, FriendLinks>();
            friendlink = friendLinksRepository[guid];
        }
        public string ChangeStatus()
        {
            friendlink.ChangeStatus();
            friendLinksRepository[friendlink.Key] = friendlink;
            return friendlink.Status.ToString();
        }
    }
}
